package com.weixstudio.jobhandler;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class JobHandler{
	private static Logger logger = LoggerFactory.getLogger(JobHandler.class);
	/**
	 * 1、简单任务示例（Bean模式）
	 */
	@XxlJob("testJobHandler")
	public void testJobHandler() throws Exception {
		logger.info("===============================================");
		XxlJobHelper.log("XXL-JOB, Hello World.");
		for (int i = 0; i < 5; i++) {
			XxlJobHelper.log("beat at:" + i);
//			TimeUnit.SECONDS.sleep(2);
		}
	}

}
